package com.bw.house.web;

import com.bw.house.controller.HouseRentController;
import com.bw.house.entity.HouseRentEntity;
import com.bw.house.service.HouseRentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @ClassName HouseController
 * @Author Hao_YunKai
 * @Date 2022/3/30 18:24
 */
@Controller
public class HouseController {
    @Autowired
    private HouseRentService houseRentService;

    @GetMapping("/zufang.html")
    public String zufang() {
        return "zufang";
    }

    // 租房详情页面
    @GetMapping("/zufang/{rentId}.html")
    public String item(@PathVariable("rentId") String rendId, Model model) {
        HouseRentEntity houseInfo = houseRentService.getById(rendId);
        model.addAttribute("houseInfo",houseInfo);
        return "zufangitem";
    }
}
